<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="${request.getContextPath()}/ReworkRecord/reworkRecord" method="post">
        <div class="bjui-searchBar">
            <g:hiddenField name="SYS_QUERY_NAME" value="reworkRecord" />
            <g:hiddenField name="EXPORT_CONTENT_NAME" value="Excel" />
            <label >批次：</label>&nbsp;
            <input type="text" name="lotId" value="${lotId}"/>&nbsp;&nbsp;
            <label >时间：</label>&nbsp;
            <input type="text" name="startTime" value="${startTime}" data-pattern="yyyy-MM-dd"  data-toggle="datepicker" placeholder="FROM">&nbsp;
            <input type="text" name="endTime" value="${endTime}" data-pattern="yyyy-MM-dd" data-toggle="datepicker" placeholder="TO">&nbsp;&nbsp;
            <label >P/N：</label>&nbsp;
            <input type="text" name="partName" value="${partName}"/>&nbsp;&nbsp;
            <label >工序状态：</label>&nbsp;
            <input type="text" name="stepDesc" value="${stepDesc}"/>&nbsp;&nbsp;
            <button type="submit" class="btn-default" data-icon="search">查询</button>&nbsp;
            <button type="button" class="btn-blue" onclick="javascript:bjuiExportExl('#pagerForm','${request.getContextPath()}/BadProcessAnalysis /exportExcel')" data-icon="file-excel-o" title="导出Excel">导出</button>&nbsp;
        </div>
    </form>
</div>

<div class="bjui-pageContent">
    <g:if test="${reworkRecord.size() > 0}">
        <table id="lapEndByBatch" data-toggle="tablefixed" data-width="100%" data-nowrap="true">
            <thead>
            <tr id="t1">
                <g:each in="${tableHeadList}" status="j" var="headInstance">
                    <g:if test="${headInstance!='RN'}">
                        <th  width="125"><g:message code="${headInstance}" default="${headInstance}"/></th>
                    </g:if>
                </g:each>
            </tr>
            </thead>
            <tbody>
            <g:if test="${reworkRecord.size()>0}">
                <g:each in="${reworkRecord}" status="i" var="dataInstance">
                    <tr>
                        <g:each in="${tableHeadList}" status="j" var="headInstance">
                            <g:if test="${headInstance=='MAIN_QTY'}">
                                <td name="BLSL${i+1}">
                                    ${dataInstance["${headInstance}"] }
                                </td>
                            </g:if>
                            <g:elseif test="${headInstance=='BFSL'}">
                                <td name="BFSL${i+1}">
                                    ${dataInstance["${headInstance}"] }
                                </td>
                            </g:elseif>
                            <g:elseif test="${headInstance!='RN'}">
                                <td>${dataInstance["${headInstance}"]}</td>
                            </g:elseif>
                        </g:each>
                    </tr>
                </g:each>
                <tr>
                    <td colspan="3">小计</td>
                    <td id="BLSL"></td>

                </tr>
                <tr>
                    <td colspan="3">合计</td>
                    <td>${reworkRecordSumQty[0].SUM_QTY}</td>
                </tr>

            </g:if>
            <g:else>
                <g:render template="../template/emptyPanel" />
            </g:else>
            </tbody>
        </table>
    </g:if>
</div>
<g:render template="../template/pagination" />

<script>
    $(function(){
        /*获取当页不良数量的小计*/
        var progressN=0
        for(var i=1;i<=${reworkRecord.size()};i++){
            var progressNo='BLSL'+i
            var progressNor = $("td[name='"+progressNo+"']").text()==''?0:parseInt($("td[name='"+progressNo+"']").text())
            if(isNaN(progressNor)){
                progressNor=0
            }
            progressN+=progressNor
        }
        $("#BLSL").html(progressN);
        /*获取当页报废数量的小计*/
        var progressN1=0
        for(var i=1;i<=${reworkRecord.size()};i++){
            var progressNo1='BFSL'+i
            var progressNor1=parseInt($("td[name='"+progressNo1+"']").text());
            if(isNaN(progressNor1)){
                progressNor1=0
            }
            progressN1+=progressNor1
        }
        progressN1 = isNaN(parseInt(progressN1))?0:progressN1
        $("#normalShow1").html(progressN1);
    })
</script>


